package com.geotmt.billingcenter.modules.statis.mapper;

import com.geotmt.billingcenter.common.entry.CostStatisEntry;
import com.geotmt.billingcenter.common.vo.cost.CostStatisVo;
import com.geotmt.billingcenter.common.vo.params.ParamsCost;
import com.geotmt.billingcenter.modules.statis.mapper.provider.CostStatisProvider;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

/**
 * @Description 类描述
 * @Author      yanghanwei
 * @Mail        yanghanwei@geotmt.com
 * @Date        2019/4/1 16:11
 * @Version     v1
 **/
@Mapper
public interface CostStatisMapper {

    /**
     * 成本list(最细力度)
     * @param obj
     * @return
     */
    @SelectProvider(type = CostStatisProvider.class, method = "costStatisList")
    List<CostStatisVo> costStatisList(ParamsCost obj);

    /**
     * 成本(周期内)历史计费量
     * @param obj
     * @return
     */
    @SelectProvider(type = CostStatisProvider.class, method = "hisCostStatis")
    CostStatisVo hisCostStatis(ParamsCost obj);

    /**
     * 删除某天的消耗统计
     * @param dayFlag
     * @param deleteTime
     * @return
     */
    @DeleteProvider(type = CostStatisProvider.class, method = "deleteCostStatisForDay")
    int deleteCostStatis(@Param(value = "dayFlag")String dayFlag,
                         @Param(value = "deleteTime")Date deleteTime);

    /**
     * 删除某段时间的消耗统计
     * @param startDay
     * @param endDay
     * @param deleteTime
     * @return
     */
    @DeleteProvider(type = CostStatisProvider.class, method = "deleteCostStatisForDate")
    int deleteCostStatis2(@Param(value = "startDay") String startDay,
                          @Param(value = "endDay") String endDay,
                          @Param(value = "deleteTime")Date deleteTime);

    /**
     * 更新统计报表中的相关维度id信息
     * @param startDay
     * @param endDay
     * @param id
     * @return
     */
    @UpdateProvider(type = CostStatisProvider.class, method = "updateCostStatis")
    int updateCostStatis(@Param(value = "startDay") String startDay,
                         @Param(value = "endDay") String endDay,
                         @Param(value = "id") Integer id);

    /**
     * 更新某天的金额
     * @param cuserId
     * @param outIfType
     * @param dayFlag
     * @param money
     * @return
     */
    @UpdateProvider(type = CostStatisProvider.class, method = "updateCostMoney")
    int updateCostMoney(@Param(value = "cuserId") Integer cuserId,
                        @Param(value = "outIfType") String outIfType,
                        @Param(value = "dayFlag") String dayFlag,
                        @Param(value = "money") Double money);

    /**
     * 批量插入统计数据
     * @param subCostStatisList
     */
    @InsertProvider(type = CostStatisProvider.class, method = "batchInsertStatis")
    void batchInsertStatis(@Param(value = "subCostStatisList")List<CostStatisEntry> subCostStatisList);

    /**
     * 成本list的总计(最细力度)
     * @param obj
     * @return
     */
    @SelectProvider(type = CostStatisProvider.class, method = "costStatisTotal")
    CostStatisVo costStatisTotal(ParamsCost obj);
}
